package com.edu.exam.enums.examination;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 监控配置类型枚举
 *
 * <p>定义安全监控系统中配置的类型，包括规则配置、阈值配置、算法配置等。</p>
 *
 * @author System
 * @version 1.0.0
 * @since 2025-11-14
 */
public enum MonitoringConfigType implements BaseEnum {

    /** 规则配置 */
    RULE("RULE", "规则配置", "监控规则和行为配置"),

    /** 阈值配置 */
    THRESHOLD("THRESHOLD", "阈值配置", "监控指标阈值和限制配置"),

    /** 算法配置 */
    ALGORITHM("ALGORITHM", "算法配置", "检测算法和分析模型配置"),

    /** 策略配置 */
    STRATEGY("STRATEGY", "策略配置", "监控策略和响应策略配置"),

    /** 系统配置 */
    SYSTEM("SYSTEM", "系统配置", "系统运行和环境配置"),

    /** 监控配置 */
    MONITORING("MONITORING", "监控配置", "监控参数和采集配置"),

    /** 报警配置 */
    ALERT("ALERT", "报警配置", "报警规则和通知配置"),

    /** 性能配置 */
    PERFORMANCE("PERFORMANCE", "性能配置", "性能监控和优化配置"),

    /** 安全配置 */
    SECURITY("SECURITY", "安全配置", "安全策略和防护配置"),

    /** 网络配置 */
    NETWORK("NETWORK", "网络配置", "网络监控和连接配置"),

    /** 存储配置 */
    STORAGE("STORAGE", "存储配置", "数据存储和归档配置"),

    /** 用户配置 */
    USER("USER", "用户配置", "用户权限和访问配置");

    private final String code;
    private final String description;
    private final String detail;

    MonitoringConfigType(String code, String description, String detail) {
        this.code = code;
        this.description = description;
        this.detail = detail;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public String getDetail() {
        return detail;
    }

    public static MonitoringConfigType fromCode(String code) {
        if (code == null || code.trim().isEmpty()) {
            throw new IllegalArgumentException("Monitoring config type code cannot be null or empty");
        }
        for (MonitoringConfigType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown monitoring config type code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}